package com.server.pinggu.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.server.pinggu.mapper.SenNewsMenuMapper;
import com.server.pinggu.domain.SenNewsMenu;
import com.server.pinggu.service.ISenNewsMenuService;

import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ltao
 * @date 2022-10-23
 */
@Service
public class SenNewsMenuServiceImpl extends ServiceImpl<SenNewsMenuMapper, SenNewsMenu> implements ISenNewsMenuService {

    @Override
    public List<SenNewsMenu> queryList(SenNewsMenu senNewsMenu) {
        LambdaQueryWrapper<SenNewsMenu> lqw = Wrappers.lambdaQuery();
        if (senNewsMenu.getPid() != null){
            lqw.eq(SenNewsMenu::getPid ,senNewsMenu.getPid());
        }
        if (senNewsMenu.getOrdering() != null){
            lqw.eq(SenNewsMenu::getOrdering ,senNewsMenu.getOrdering());
        }
        if (StringUtils.isNotBlank(senNewsMenu.getTitle())){
            lqw.eq(SenNewsMenu::getTitle ,senNewsMenu.getTitle());
        }
        if (StringUtils.isNotBlank(senNewsMenu.getTitleEn())){
            lqw.eq(SenNewsMenu::getTitleEn ,senNewsMenu.getTitleEn());
        }
        if (senNewsMenu.getIstrue() != null){
            lqw.eq(SenNewsMenu::getIstrue ,senNewsMenu.getIstrue());
        }
        if (StringUtils.isNotBlank(senNewsMenu.getKeywords())){
            lqw.eq(SenNewsMenu::getKeywords ,senNewsMenu.getKeywords());
        }
        if (StringUtils.isNotBlank(senNewsMenu.getLang())){
            lqw.eq(SenNewsMenu::getLang ,senNewsMenu.getLang());
        }
        if (StringUtils.isNotBlank(senNewsMenu.getDisplay())){
            lqw.eq(SenNewsMenu::getDisplay ,senNewsMenu.getDisplay());
        }
        if (StringUtils.isNotBlank(senNewsMenu.getPic())){
            lqw.eq(SenNewsMenu::getPic ,senNewsMenu.getPic());
        }
        if (StringUtils.isNotBlank(senNewsMenu.getPics())){
            lqw.eq(SenNewsMenu::getPics ,senNewsMenu.getPics());
        }
        if (senNewsMenu.getTid() != null){
            lqw.eq(SenNewsMenu::getTid ,senNewsMenu.getTid());
        }
        return this.list(lqw);
    }
}